#include"head.hh"
class Line::LineItem{
public:
    class Point{
    public:
        Point(int x,int y)
            :_x(x)
             ,_y(y){
                 cout<<"Point"<<endl;
             }
        ~Point(){
            cout<<"~Point"<<endl;
        }
        void  print(){
            cout<<"("<<_x<<","<<_y<<")";
        }
    friend class LineItem;
    private:
        int _x;
        int _y;
    };
    LineItem(int x,int y,int x1,int y1)
        :_p1(Point(x,y))
        ,_p2(Point(x1,y1)){
            cout<<"LineItem"<<endl;
        }
    ~LineItem(){
        cout<<"~LineItem"<<endl;
    }
    void print(){
        _p1.print();
        cout<<"----------->";

        _p2.print();
        cout<<endl;
    }
private:
    Point _p1;
    Point _p2;

};
Line::Line(int x,int y,int x1,int y1)
    :_line(new LineItem(x,y,x1,y1))
{
    cout<<"Line"<<endl;
}
Line::~Line(){
    if(_line){
        delete _line;
        _line = nullptr;
    }
    cout<<"~Line"<<endl;
}
void Line::print(){
    _line->print();
}
